//
//  RetweetView.swift
//  开心微博
//
//  Created by 郑开心 on 15/12/13.
//  Copyright © 2015年 郑开心. All rights reserved.
//

import UIKit

class RetweetView: UIImageView {
    var nameView : UILabel!
    var textView : UILabel!
    var photosView : PhotosView!
    
    var statusFrame : StatusFrame!{
        didSet{
            setStatus()
        }
    }
    
    override init(frame: CGRect) {
        super.init(frame: frame)
        setUpAllChindView()
        self.userInteractionEnabled = true
        self.image = UIImage.imageWithStretchableName("timeline_retweet_background")
    }
    
    required init?(coder aDecoder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
    
    func setUpAllChindView(){
        
        //昵称
        nameView = UILabel()
        nameView.textColor = UIColor.blueColor()
        nameView.font = Coant.NameFont
        self.addSubview(nameView)
        
        textView = UILabel()
        textView.font = Coant.TextFont
        textView.numberOfLines = 0
        self.addSubview(textView)
        
        photosView = PhotosView(frame: CGRectMake(0, 0, 0, 0))
        self.addSubview(photosView)

    }
    func setStatus(){
        let status = statusFrame.status.retweeted_status
        nameView.frame = statusFrame.retweetNameFrame!
        nameView.text = status?.user.name
        
        textView.frame = statusFrame.retweetTextFrame!
        textView.text = status?.text
        photosView.frame = statusFrame.retweetPhotosFrame!

        photosView.pic_urls = status?.pic_urls
        
         //print("\(status?.pic_urls)\(status?.text)")
        
    }
}
